//
//  PituanCell.m
//  中皮网
//
//  Created by ios程序员 on 15/10/29.
//  Copyright (c) 2015年 ios程序员. All rights reserved.
//

#import "PituanCell.h"
#import "PituanCollectionCell.h"

@interface PituanCell ()
@end

@implementation PituanCell



- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.pitImage = [[UIImageView alloc] init];
        [self.contentView addSubview:self.pitImage];
        [self.pitImage setImage:[UIImage imageNamed:@"like"]];
        
        self.jianJLabel = [[UILabel alloc] initWithFrame:CGRectMake(WI/3+40*WIDTH, 20, WI/5*4, HI/5)];
        self.jianJLabel.text = @"某某皮草某某皮草某某皮草某某皮草某某皮草某某皮草";
        self.jianJLabel.font = [UIFont systemFontOfSize:12];
        self.jianJLabel.numberOfLines = 0;
        [self addSubview:self.jianJLabel];
        
        self.addreSS = [[UILabel alloc] initWithFrame:CGRectMake(WI/3+40*WIDTH, 60, WI/5*1, HI/5)];
        self.addreSS.text = @"哈尔滨";
        self.addreSS.textColor = [UIColor grayColor];
        self.addreSS.font = [UIFont systemFontOfSize:13];
        [self addSubview:self.addreSS];
        
        self.baoYouLabel = [[UILabel alloc] initWithFrame:CGRectMake(WI/3 + 200*WIDTH,60, WI/5*1, HI/5)];
        self.baoYouLabel.textColor = [UIColor grayColor];
        self.baoYouLabel.text = @"包邮";
        self.baoYouLabel.font = [UIFont systemFontOfSize:13];
        [self addSubview:self.baoYouLabel];
        
        self.priceLabel = [[UILabel alloc] initWithFrame:CGRectMake(WI/3+40*WIDTH, 105, WI/5*2, HI/5)];
        self.priceLabel.text = @"10000.00";
        self.priceLabel.textColor = [UIColor redColor];
        self.priceLabel.font = [UIFont systemFontOfSize:12];
        [self addSubview:self.priceLabel];
        
        self.sCbutton = [UIButton buttonWithType:UIButtonTypeCustom];
        self.sCbutton.frame = CGRectMake(WI/3+200*WIDTH,85*HEIGH, HI/5*2, HI/5*2);
        [self.sCbutton setImage:[UIImage imageNamed:@"shi"] forState:UIControlStateNormal];
        [self addSubview:self.sCbutton];
        
        [self.sCbutton addTarget:self action:@selector(sCbuttonClick:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return self;
}

- (void)sCbuttonClick:(UIButton *)button
{
    button.selected = !button.selected;
    if ((button.selected == NO)) {
        [self.sCbutton setImage:[UIImage imageNamed:@"shi"] forState:UIControlStateNormal];
    }else if ((button.selected == YES)){
        [self.sCbutton setImage:[UIImage imageNamed:@"kong"] forState:UIControlStateNormal];
    }
}

- (void)layoutSubviews{
    self.pitImage.frame = CGRectMake(5*WIDTH, 10*HEIGH, self.frame.size.width/3, 100*HEIGH);
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
